package com.stek.utils;

import java.util.ArrayList;

import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;

import com.stek.R;
import com.stek.admin.DeviceReceiver;
import com.stek.admin.DummyActivity;

public class CONFIG {

	public static class BROADCAST {
		public static String ACTION_FAVORITE_APP_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_FAVORITE_APP_CHANGED";
		public static String ACTION_MAIN_PANEL_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_MAIN_PANEL_CHANGED";
		public static String ACTION_SUB_PANEL_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_SUB_PANEL_CHANGED";
		public static String ACTION_FLOATING_ICON_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.ACTION_FLOATING_ICON_SETTINFS";
		public static String ACTION_SHOW_ICON_ON_LOCK_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.ACTION_SHOW_ICON_ON_LOCK_SETTINFS";
		public static String ACTION_FLOAT_ICON_RESOURCE_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_FLOAT_ICON_CHANGED";

		public static String EXTRA_FLOATING_ICON_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.EXTRA_FLOATING_ICON_SETTINFS";
		public static String EXTRA_SHOW_ICON_ON_LOCK_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.EXTRA_SHOW_ICON_ON_LOCK_SETTINFS";
		public static String EXTRA_FLOAT_ICON_RESOURCE = "com.slh.touchandroid.utils.BROADCAST.EXTRA_FLOAT_ICON_RESOURCE";
	}

	public static class FEEDBACK {
		public static String EMAIL = "sanglehoang89@gmail.com";
		public static String SUBJECT = "One Touch";
	}

	public static class LOCK {
		/*
		 * public static void disable(Context context) {
		 * 
		 * ADMIN_DEVICE.getDeviceAdmin(context).setMaximumTimeToLock(
		 * ADMIN_DEVICE.getDeviceAdminComponentName(context), 0); }
		 * 
		 * public static void enable(Context context) {
		 * ADMIN_DEVICE.getDeviceAdmin(context).setMaximumTimeToLock(
		 * ADMIN_DEVICE.getDeviceAdminComponentName(context), 30000);
		 * 
		 * }
		 */
	}

	public static class ADMIN_DEVICE {
		public static void removeDeviceAdmin(Context context) {
			DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
					.getSystemService(Context.DEVICE_POLICY_SERVICE);
			ComponentName compName = new ComponentName(context,
					DeviceReceiver.class);
			if (devicePolicyManager.isAdminActive(compName)) {
				devicePolicyManager.removeActiveAdmin(compName);
				return;
			}
		}

		public static DevicePolicyManager getDeviceAdmin(Context context) {
			return (DevicePolicyManager) context
					.getSystemService(Context.DEVICE_POLICY_SERVICE);
		}

		public static ComponentName getDeviceAdminComponentName(Context context) {
			return new ComponentName(context, DeviceReceiver.class);
		}

		public static boolean isDeviceAdmin(Context context) {
			DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
					.getSystemService(Context.DEVICE_POLICY_SERVICE);
			ComponentName compName = new ComponentName(context,
					DeviceReceiver.class);
			return devicePolicyManager.isAdminActive(compName);
		}

		public static void addDeviceAdmin(Context context) {
			AppUtils.launchActivity(context, DummyActivity.class);
		}

		public static void toggleDeviceAdmin(Context context, boolean value) {
			if (value) {
				addDeviceAdmin(context);
			} else {
				removeDeviceAdmin(context);
			}
		}

	}

	public static class FLOAT_ICON {
		public static int getFloatIcon(Context context) {
			return SharePreferenceUtils.getPrefInt(context,
					context.getString(R.string.key_float_icon),
					R.drawable.ic_android0);
		}

		public static boolean isShowFloatIcon(Context context) {
			return SharePreferenceUtils.getPrefBoolean(context,
					context.getString(R.string.key_show_float_icon), true);
		}

		public static void setFloatIcon(Context context, int resId) {
			SharePreferenceUtils.putPrefInt(context,
					context.getString(R.string.key_float_icon),

					resId);
		}
	}

	public static class SKU {
		public static ArrayList<String> getSkuName() {
			ArrayList<String> sku = new ArrayList<String>();
			sku.add("one_smile");
			sku.add("two_smiles");
			sku.add("three_smiles");
			return sku;

		}

		public static ArrayList<Integer> getSkuRes() {
			ArrayList<Integer> sku = new ArrayList<Integer>();
			sku.add(R.drawable.ic_one_smile);
			sku.add(R.drawable.ic_two_smiles);
			sku.add(R.drawable.ic_three_smiles);
			return sku;

		}
	}
}
